#ifndef _SCHEDULER_H_
#define _SCHEDULER_H_


#include "scenario.h"
#include "storageaffinity.h"
#include "informationadaptability.h"
#include "xsufferage.h"
#include "workqueuewr.h"
#include "rumr.h"


class Scheduler {
	private:
		/*Heuristic adopted by the scheduler*/
		SchedulingHeuristic *heuristic;
		/*The grid on which the job is scheduled*/
		Grid *grid;
		/*The Job to be scheduled*/
		Job *job;
		/*Partioner*/
		AdaptivePartitioner *adaptivePartioner;
		/*Scenario*/
		Scenario *scenario;
		
		void setHeuristic(int heuristic_id, long double error_rate=0);	
		
	public:
		/*Constants to represent each possible heuristic*/
		enum {STOAFF, XSUFF, INFOADAPT, WQR, RUMR};
		/*Error option*/
		enum {WITHOUT_ERROR, WITH_ERROR};
		/*Constructor*/
		Scheduler(Scenario *scenario, int heuristic_id, int error=WITHOUT_ERROR, long double gridUnavailability=0);
		/*Destructor*/
		~Scheduler();
		/*Schedules this scenario using this heuristic. Returns the makespan*/
		long double schedule();
		/*Get the heuristic used by the scheduler*/
		SchedulingHeuristic *getHeuristic();
		/*Gets the job*/
		void resetJob();
		/*Update Offset of All Grid Resources*/
		void updateGridResourcesOffset(long double new_offset);
		
};

#endif //_SCHEDULER_H_
